package com.martin.fastframe.ui.main

import android.view.View
import com.martin.fastframe.R
import com.martin.fastframe.databinding.ItemTextBinding
import com.martin.lib_base.annotation.ItemData
import com.martin.lib_base.base.BaseViewHolder
import com.martin.lib_base.interfaces.IItemData

@ItemData(TextViewHolder.Companion.ItemData::class)
class TextViewHolder(view: View) : BaseViewHolder<String, ItemTextBinding>(view) {

    override fun onBindViewHolder(position: Int, item: Any?) {
        binding.tv.text = getItemBean(item)

        //监听点击事件
        itemView.setOnClickListener {
            //通知点击事件
            notifyItemClick()
        }
    }

    companion object {
        class ItemData : IItemData {
            override fun getItemLayoutId() = R.layout.item_text
        }
    }

}

